Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Account and Storage to merkle_patricia_proofs #316

Merged
merged 11 commits into from
May 28, 2024

Conversation

Pasifaee
Copy link
Contributor

No description provided.


fn get_storage_value(rlp_encoded_value: [u8; MAX_STORAGE_VALUE_LEN]) -> [u8; MAX_STORAGE_VALUE_LEN] {
let mut storage_value = rlp_encoded_value;
let rlp_value_len = right_pad(rlp_encoded_value).len();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left_padded_len

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rewrote this function, now it uses Fragments and I think this name is outdated

ethereum/circuits/lib/src/account_with_storage.nr Outdated Show resolved Hide resolved
ethereum/circuits/lib/src/account_with_storage.nr Outdated Show resolved Hide resolved
ethereum/circuits/lib/src/account_with_storage.nr Outdated Show resolved Hide resolved
ethereum/circuits/lib/src/misc/bytes.nr Show resolved Hide resolved
@@ -109,7 +110,7 @@ unconstrained fn get_receipt_unconstrained_M(
cumulative_gas_used: receipt.cumulative_gas_used,
logs_bloom: receipt.logs_bloom
};
let proof_input = ProofInput::deserialize(proof_input);
let proof_input: ProofInput<MAX_PREFIXED_KEY_NIBBLE_LEN, MAX_VALUE_LEN_M, MAX_DEPTH_NO_LEAF, MAX_LEAF_LEN_M> = Serde::deserialize(proof_input);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it work without annotation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, actually it works, I'll remove the annotations everywhere

wrong_proof.proof[0] += 1;
let _ = verify_account(state_proof.key, account, wrong_proof, state_root);
let mut wrong_proof = state_proof_input;
wrong_proof.proof.nodes[0][0] -= 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alter_array?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doing +1 instead of -1 causes a compiler panic

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about RLP lel len issue and compiler panic

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

ethereum/circuits/lib/src/verifiers/storage.nr Outdated Show resolved Hide resolved
wrong_address[0] += 1;
let _ = verify_account(wrong_address, account, state_proof, state_root);
let _ = verify_account(wrong_address, account, state_proof_input, state_root);
}

// TODO: Add correct assertion message when noir-trie-proofs is updated
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still a TODO? Seems like we don't even use noir-trie-proofs any more

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, added correct assertion message

wrong_proof.proof[0] += 1;
let _ = verify_account(state_proof.key, account, wrong_proof, state_root);
let mut wrong_proof = state_proof_input;
wrong_proof.proof.nodes[0][0] -= 1;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment about RLP lel len issue and compiler panic

@Pasifaee Pasifaee added this pull request to the merge queue May 28, 2024
Merged via the queue into main with commit 26952dd May 28, 2024
6 checks passed
@Pasifaee Pasifaee deleted the iza/state_migration branch May 28, 2024 12:58
github-merge-queue bot pushed a commit that referenced this pull request May 29, 2024
This PR removes old proof fixtures as we don't use them anymore. It is a
PR on top of #316
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants